Skip to content

Compile the tag attribute regex once, not per tag [ai] - #74

Merged
ghedwards merged 1 commit into
masterfrom
perf/precompile-attribute-regex
Sep 11, 2026
Merged

Compile the tag attribute regex once, not per tag [ai]#74
ghedwards merged 1 commit into
masterfrom
perf/precompile-attribute-regex

Conversation

@ghedwards

Copy link
Copy Markdown

CFMLStartTag.getAttributes ran Pattern.compile(REG_ATTRIBUTES, CASE_INSENSITIVE) on every call, i.e. for every tag with attributes in a scan. Hoisted to a static final field.

Found while profiling a CFLint full-repo scan with JFR (6,544 CFML files). Worth ~0.14% of scan time on its own - small, but free.

🤖 Generated with Claude Code

CFMLStartTag.getAttributes ran Pattern.compile(REG_ATTRIBUTES, CASE_INSENSITIVE)
on every call, i.e. for every tag with attributes in a scan. Hoisted to a
static final field.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@ghedwards
ghedwards merged commit 691c939 into master Sep 11, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants